﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
body {
  overflow-x: hidden;
  overflow-y: hidden;
  margin-left: 0px; 
} 
.xnml-logo {background:#3B8858 url(http://www.sandieji.com/b1/actions/top.gif) no-repeat scroll left;border-bottom:2px solid #5872A1;height:91px;position:relative;}
.xnml-header {background:#F7F7F7 none repeat scroll 0 0;border-bottom:1px solid #CCCCCC;margin-bottom:2px;width:800px}
.xnmls-tabs {bottom:0;position:absolute;right:20px;}
.xnmls-tabs li {float:left;margin-left:10px;}
.xnmls-tabs .current a {background:#5D74A2 none repeat scroll 0 0;}
.xnmls-tabs a {background:#486598 none repeat scroll 0 0;color:#FFFFFF;display:block;padding:4px 10px;text-decoration:none;}
.xnmls-tabs a:hover {background:#5D74A2 none repeat scroll 0 0;}
ul {list-style-image:none;list-style-position:outside;list-style-type:none;}
.box1, .box2{
	text-align:center; 
	margin:2px 0px 0px 0px;
	height: 25px;
	vertical-align: middle;
	line-height: 25px;
}
.box1{
	border:1px solid #ffa200;
	background-color:#fff6e6;
}
.box2{
	border:1px solid #0094e0;
	background-color:#dbf3ff;
}
</style>
  <script type="text/javascript" src="./js/renren.js"></script>
  <script type="text/javascript">
    function sendRequest(isSendToMany, toId) {
      var params = {"accept_url":"http://apps.renren.com/longniaozhentan/welcome.php","accept_label":"接受邀请"};
      var style = {
			  "width":650,  
			  "height":530  
		  };
      if (isSendToMany) {
          params["actiontext"] = "邀请好友一起来玩吧";
      }
      else {
          params["to"] = toId;
      }
	  var uiOpts = {
		  url : "request",
		  display : "iframe",
		  params : params,
		  style : style,
		  onSuccess: function(r){},
		  onFailure: function(r){} 
	  };
	  Renren.ui(uiOpts);
    }
    function sendFeed(name, description) {
	  var uiOpts = {
		  url : "feed",
		  display : "iframe",
		  params : {
		    "url":"http://apps.renren.com/longniaozhentan/welcome.php",
		    "name":name,
		    "description":description,
		    "image":"http://www.sandieji.com/b1/actions/Logo.png",
		    "action_name": "龙鸟侦探",
		    "action_link":"http://apps.renren.com/longniaozhentan/welcome.php"
		  },
		  onSuccess: function(r){},
		  onFailure: function(r){} 
	  };
	  Renren.ui(uiOpts);
    }
    function sendFeed2()
    {
	sendFeed("散落的羽毛，模糊的爪印，到底谁才是幕后真凶？", "作为大侦探，我正在和狡猾的罪犯斗智斗力！");
    }
    

function showCZ()
{
//	document.getElementById('B2dev').style.display = "none";
	document.getElementById('zfPopUp').style.display = "block";
}

function hideCZ()
{
//	document.getElementById('B2dev').style.display = "block";
	document.getElementById('zfPopUp').style.display = "none";
}
  </script>
</head>
<body>
<?php
require_once "server.class.php";
require_once "db.class.php";
require_once "config.php";

function generateSig($params_array, $secret)
{
	$str = "";
	ksort($params_array);
	foreach ($params_array as $k=>$v)
	{
		if (strpos($k, "xn_sig_") === 0)
		{
			$k = substr($k, 7);
			$str .= "$k=$v";
		}
	}
	$str .= $secret;
	return md5($str);
}

//验证人人网身份
if (generateSig($_GET, $rrSecret) == $_GET['xn_sig'])
{
	$params = array("host"=>"$host", "user"=>"$user", "pass"=>"$pass", "db"=>"$db");
	$db = new Dbclass($params, false);
	$server = new ServerHelperClass($db, $tables);

	$sessionId = $timeStamp;
	$callId = $timeStamp;
	$renrenId = $_GET['xn_sig_user'];

	$sql = "select id from ".$tb_user_profile." where renrenId = ".$renrenId;
	$result = $db->query($sql);
	//用户已经创建
	if ($arr = $db->fetchArray($result))
	{
		$userId = $arr['id'];
	}
	else
	{
		$userId = $server->createUser($renrenId);
	}
	//更新用户session
	$sql = "update ".$tb_user_profile." set sessionId = ".$sessionId.", callId = ".$callId." where id = ".$userId;
	$result = $db->query($sql);
}

?>
<script type="text/javascript">Renren.init({appId:102230});</script>
<div class="xnml-header">
	<div class="xnml-logo">
		<div class="xnmls-tabs">
			<ul>
				<li><a href="javascript:showCZ();">充值</a></li>
				<li><a href="javascript:sendRequest(true);">邀请好友</a></li>
				<li><a href="#">应用主页</a></li>
				<li><a href="#">应用帮助</a></li>
			</ul>
		</div>
	</div>
	<div class="box2">
		<span><a href="#">坦克大战。</a></span>
	</div>

	<div id="zfPopUp" style="width:800px;height:600px;display:none;border:0px solid red;">
		<iframe id="zf_ifr" name="zf_ifr" src="pay.php?<?php echo "xn_sig_user=".$_GET['xn_sig_user']."&amp;xn_sig_session_key=".$_GET['xn_sig_session_key'] ?>" frameborder="0" height="600" width="800" allowtransparency="true" scrolling="no"></iframe>
		<div id="zfClose" style="position:relative;left:723px;top:-580px;width:40px;height:40px;display:block;background:url('http://www.sandieji.com/b2/actions/close.png');cursor:pointer" onclick="hideCZ()"></div>
	</div>
	<div id="flashContainer" style="background-image:url('http://www.sandieji.com/b2/actions/base.jpg');width:800px;height:600px;" >
		<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="B2dev" width="800" height="600"
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
			<param name="movie" value="B2dev.swf" />
			<param name="FlashVars" value="<?php echo "xn_sig_user=".$_GET['xn_sig_user']."&amp;xn_sig_session_key=".$_GET['xn_sig_session_key']."&amp;userId=".$userId."&amp;sessionId=".$sessionId."&amp;timeStamp=".$timeStamp ?>">
			<param name="quality" value="high" />
			<param name="bgcolor" value="#000000" />
			<param name="allowScriptAccess" value="always" />
			<embed src="http://www.sandieji.com/b2dev/actions/B2dev.swf" FlashVars="<?php echo "xn_sig_user=".$_GET['xn_sig_user']."&amp;xn_sig_session_key=".$_GET['xn_sig_session_key']."&amp;userId=".$userId."&amp;sessionId=".$sessionId."&amp;timeStamp=".$timeStamp ?>"
				quality="high" bgcolor="#000000"
				width="800" height="600" name="B2dev" align="middle"
				play="true"
				loop="false"
				quality="high"
				allowScriptAccess="always"
				type="application/x-shockwave-flash"
				pluginspage="http://www.adobe.com/go/getflashplayer">
			</embed>
		</object>
	</div>

</div>
<img style="padding-top:6px;" width="800" height="140" src="http://www.sandieji.com/b1/actions/bottom.gif" />
<div style="width:96%;text-align:center;color:#808080;padding-top:20px;padding-bottom:20px;">趣鸟网络 &copy; 2011-2011</div>
</body>
</html>

